/*
 * Copyright 2008,2009,2010 Daniel Freitas
 * 
 * This file is part of DMF Generic DAO.
 * 
 * DMF Generic DAO is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
 * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
 * later version.
 * 
 * DMF Generic DAO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with DMF Generic DAO. If not, see
 * <http://www.gnu.org/licenses/>.
 */
package com.googlecode.dmf.genericdao.util;

import java.lang.reflect.Method;

import com.googlecode.dmf.genericdao.GenericDao;

public interface Reflectioner {

    /**
     * Gets a {@link Method} object from the given class. This has the same effect as calling
     * <tt>clazz.getMethod(methodNames, parameterTypes);</tt>.
     * <p/>
     * This method throws the same exceptions as {@link Class#getMethod(String, Class...)}
     * 
     * @param clazz
     *            The {@link Class} object to get the {@link Method} from.
     * @param methodName
     *            The method name.
     * @param parameterTypes
     *            The method parameter types.
     * @return The {@link Method} object representing the method of the provided {@link Class}.
     * 
     * @see Class#getMethod(String, Class...)
     */
    public Method getMethodByName(final Class<?> clazz, final String methodName, final Class<?>... parameterTypes)
            throws SecurityException, NoSuchMethodException;

    /**
     * Given the {@link Class}, checks if this class is a {@link GenericDao} interface and attempts to get the entity
     * {@link Class} this dao is responsible to persist.
     * 
     * @param clazz
     *            The class to check.
     * @return A {@link Class} object representing the entity thhe provided clazz is responsible to persist (if the
     *         provided clazz is a {@link GenericDao}); <tt>null</tt> if the information can't be retrieved or if the
     *         class is not a {@link GenericDao}.
     */
    public Class<?> getDaoEntityClass(final Class<?> clazz);

}